package com.laopan.wxpay.bean.callback;

import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * 微信回调请求头
 * @author laopan
 * @className CallBackHeader
 * @date 2021/3/5 17:16
 */

public class CallbackHeader {
    /**
     * 序列号
     */
    private  String serialNo;
    /**
     * 随机字符
     */
    private String nonceStr;
    /**
     * 时间戳
     */
    private String timestamp;
    /**
     * 签名字符串
     */
    private String sign;

    public String getSerialNo() {
        return serialNo;
    }

    public void setSerialNo(String serialNo) {
        this.serialNo = serialNo;
    }

    public String getNonceStr() {
        return nonceStr;
    }

    public void setNonceStr(String nonceStr) {
        this.nonceStr = nonceStr;
    }

    public String getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(String timestamp) {
        this.timestamp = timestamp;
    }

    public String getSign() {
        return sign;
    }

    public void setSign(String sign) {
        this.sign = sign;
    }
    public String packageSign(String body){
       return Stream.of(timestamp, nonceStr, body)
                .collect(Collectors.joining("\n", "", "\n"));
    }
}
